/* 
 * Copyright [2018] [Alex/libo(liboware@gmail.com)]
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *  http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package com.hyts.infodb.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.Setter;

/**
 * @author LiBo/Alex
 * @see SystemConfiguration.PageConfiguration
 * @version V1.0 
 */
public interface SystemConfiguration {

    String DEFAULT_GLOBAL_PACKAGE = "com.hyts.infodb";

    int DEFAULT_ROUTE_CODE = 2;

    int DEFAULT_SESSION_TIME_OUT = 1800;

    int DEFAULT_SHUTDOWN_TIMEOUT = 30;

    String DEFAULT_SYSTEM_MENU = "sys_menu";

    String DEFAULT_USER_CODE = "SYS_USER";

    String DEFAULT_LAST_LOGIN_DATE = "LAST_LOGIN_DATE";


    /** 
     * 分页操作默认配置
     */  
    public enum PageConfiguration{
        //分页大小
        PAGE_SIZE(10),
        //分页数目
        PAGE_NUM(0);
        private Object value;
        private PageConfiguration(Object value) {
            this.value = value;
        }
        public Object getValue() {
            return value;
        }
    }
    /**
          * 结果操作默认配置
     */
    public enum ResultConfiguration{
        //成功
        SUCCESS(200,"成功"),
        FAILURE(500,"失败");
        
        private int code;
        private String message;
        
        /**  
         * @constructor：ResultConfiguration  
         * @param code
         * @param message  
         */ 
        private ResultConfiguration(int code, String message) {
            this.code = code;
            this.message = message;
        }
        /**  
         * @name message's getter method
         * @return message
         */
        public String getMessage() {
            return message;
        }
        public int getCode() {
            return code;
        }
    }
    
    /**
          *  消息返回信息配置
     */
    public enum MessageConfiguration{
        SAVE("保存%s数据%s"),
        REMOVE("刪除%s数据%s"),
        LOAD("加载%s数据%s"),
        QUERY("查询%s数据%s"),
        UPLOAD("上传%s数据%s"),
        DOWNLOAD("下载%s数据%s"),
        EXECUTE("执行%s操作%s"),
        LOGIN("登录%s操作%s"),
    	REGISTER("注册%s操作%s");
        private String message;
        MessageConfiguration(String message) {
            this.message = message;
        }
        public String getMessage() {
            return message;
        }
    }
    
    public enum JsonConfiguration{
        
        JSON_SHOW_FORMAT("pretty"),
        JSON_DATE_FORMAT("yyyy-MM-dd HH:mm:ss"),
        JSON_DATA_ENCODE("UTF-8");
        
        private String value;
        /**  
         * @constructor：JsonConfiguration  
         * @param value  
         */ 
        private JsonConfiguration(String value) {
            this.value = value;
        }
        /**  
         * @name value's getter method
         * @return value
         */
        public String getValue() {
            return value;
        }
        /**  
         * @name value's setter method
         * @param value
         * @return void
         */
        public void setValue(String value) {
            this.value = value;
        }
    }

    /**
     * redis服务
     */
    @AllArgsConstructor
    public enum RedisConfiguration{
        REDIS_SHIRO_CACHE("shiro:cache:"),
        REDIS_SESSION_CACHE("shiro:session:"),
        REDIS_SYSTEM_CACHE("shiro:web:");
        @Setter
        @Getter
        private String value;
    }
}
